//node相关支持
const http = require('http');
const fs = require('fs');
const path = require('path');
const bodyParser = require('body-parser');
const express = require('express');
let app = express();
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());

//接口文件路径
//用户接口
const usersApi = require('./api/usersApi');
//商品类型接口
const typeApi = require('./api/typeApi');
//商品接口
const booksApi = require('./api/booksApi');
//订单接口
const ordersApi = require('./api/ordersApi');
//订单详情接口
const ordersDescApi = require('./api/ordersDescApi');
//收藏接口
const shoucangApi = require('./api/shoucangApi');
//地址接口
const dizhiApi = require('./api/dizhiApi');
//评价接口
const commentsApi = require('./api/commentsApi');
//轮播接口
const lunboApi = require('./api/lunboApi');
//购物车接口
const cardApi = require('./api/cardApi');



// 后端api路由接口路径
app.use('/api/users', usersApi);
app.use('/api/type', typeApi);
app.use('/api/books', booksApi);
app.use('/api/orders', ordersApi);
app.use('/api/comments', commentsApi);
app.use('/api/card', cardApi);
app.use('/api/lunbo', lunboApi);
app.use('/api/ordersDesc', ordersDescApi);
app.use('/api/shoucang', shoucangApi);
app.use('/api/dizhi', dizhiApi);


// 服务器端口
const server = app.listen(3000,function () {
 const {address,port} =server.address() 
 console.log('服务启动成功 http://',address,port) 
}) 
